<?php

namespace app\admin\controller;

use app\admin\model\ApiDesc;
use app\admin\model\ApiGroup;
use support\Request;

class Api extends BaseController
{
    protected $preViewName = 'api';

    protected $model = ApiGroup::class;

    public function index(Request $request) {
        $list = ApiGroup::query()->with('apidescs')->orderByDesc('weigh')->get();
        $list->makeVisible(['id','name', 'apidescs' => ['id','title']]);
        $this->assign('list', $list);
        return $this->view();
    }

    public function show(Request $request) {
        $apiDesc = ApiDesc::query()->findOrFail($request->get('id'));
        $this->assign('row', $apiDesc);
        return $this->view();
    }
}
